<div ng-include="'html/component/nav.html'" ng-controller="NavCtrl"></div>
<ul class="set_item" ng-include="'html/component/left_nav.html'" ng-controller="OrderNavCtrl"></ul>

<style>
    .list_animate{
        -webkit-transition: all 0.2s;
        transition: all 0.2s;
        position: relative; left:0px;
    }
    .list_animate.ng-hide{left:-1000px;}
    .set_cont.list_page .list_table th{width:auto;}
    .set_cont.list_page .list_table td{ width:auto;}
    .set_cont.list_page .list_table .list_unit td:first-child{ color:#666; text-decoration:none;}
    .set_cont.list_page .list_table .list_unit td:nth-child(2){ color:#027676; text-decoration:underline;}
    .set_cont.list_page .list_table .list_unit td:nth-child(2) a{ color:#027676; text-decoration:underline; cursor:pointer;}
</style>

<div class="set_box">
    <h1 class="set_title"><!--小票-->{{language.TIPS_RECEIPT}}
        <span class="title_btn_group">
            <a ng-show="buttonReturn == 1" class="title_btn" href="javascript:void(0);" ng-click="goto_return();" ><!--退货-->{{language.TIPS_RECEIPT_RETURN_GOODS_A}}</a>
            <a ng-show="buttonThirdReturn == 1" class="title_btn" href="javascript:void(0);" ng-click="goto_third_return();" ><!--第三方支付退款-->{{language.TIPS_RECEIPT_THIRD_RETURN}}</a>
            <a ng-show="buttonThirdUpload == 1" class="title_btn" href="javascript:void(0);" ng-click="goto_third_upload();" ><!--第三方支付上传-->{{language.TIPS_RECEIPT_THIRD_UPLOAD}}</a>
            <a ng-show="buttonPrint == 1" class="title_btn" href="javascript:void(0);" ng-click="to_print();" ><!--补印-->{{language.TIPS_RECEIPT_REPRINT}}</a>
            <a ng-show="buttonClose == 1" class="title_btn" href="javascript:void(0);" ng-click="close_detail();" ><!--关闭-->{{language.TIPS_RECEIPT_CLOSE}}</a>
            <a ng-show="buttonDestroy == 1" class="title_btn" href="javascript:void(0);" ng-click= "selectDestroy();" ><!--作废-->{{language.TIPS_RECEIPT_CAN}}</a>
            <a ng-show="buttonUpload == 1" class="title_btn" href="javascript:void(0);" ng-click="btn_upload(xiaopiao);" ><!--上传-->{{language.TIPS_RECEIPT_UPLOAD}}</a>

            <a ng-show="buttonHigh == 1" class="title_btn" href="javascript:void(0);" ng-click="search();" ><!--高级查询-->{{language.TIPS_RECEIPT_ADVANCE_QUERY}}</a>
            <a ng-show="buttonRefresh == 1" class="title_btn" href="javascript:void(0);" ng-click="refresh_data();" ><!--刷新-->{{language.TIPS_RECEIPT_REFRESH}}</a>

        </span>
    </h1>
    <!-- infinite-scroll="scoll.nextpage();" infinite-scroll-disabled='scoll.busy' infinite-scroll-distance='3' -->
    <div class="set_cont list_page list_animate" ng-show="buttonRefresh == 1">
        <table class="list_table">
            <thead>
                <tr>
                    <th><!-- 时间 -->{{language.TIPS_RECEIPT_TIME}}</th>
                    <th><!--单据编号-->{{language.TIPS_RECEIPT_DOC_SEQ}}</th>
                    <th><!--会员编号-->{{language.TIPS_VIP_NUM}}</th>
                    <th><!--数量-->{{language.TIPS_RECEIPT_NUM}}</th>
                    <th><!--金额-->{{language.TIPS_RECEIPT_MONEY}}</th>
                    <th><!--状态-->{{language.TIPS_RECEIPT_STATUS}}</th></tr>
            </thead>
            <tbody ng-repeat="i in xiaopiao_list| orderBy:'key':true" >
                <tr ng-show="buttonMore == 1" class="date_num">
                    <td class="date" colspan="5"><!--日期-->{{language.TIPS_RECEIPT_DATE}}：{{i.key}}</td>
                    <td class="num">
                        <span>{{i.value.length}}</span>
                    </td>
                </tr>
                <tr class="list_unit" ng-repeat="li in i.value track by $index"  >
                    <td>{{li.record_time | split_filter:" ":1}}</td>
                    <td ng-click="show_detail(li.record_code);"><a href="javascript:void(0)">{{li.record_code}}</a></td>              
                    <td>{{li.vip_code}}</td>
                    <td>{{li.num}}</td>
                    <td>{{li.final_money|number:2}}</td>
                    <td>{{li.is_checkout|check_is_checkout}}</td>
                </tr>
            </tbody>
        </table>
        <div class="btn_more"><!--更多--><button class="btn" ng-click='scoll.nextpage();' ng-show="buttonMore == 1"></button></div>
    </div>

    <div class="set_cont detail_page" ng-show="buttonRefresh == 0" ng-swipe-right="close_detail();" >
        <form class="detail_form">
            <p class="title">
                <!--单号-->{{language.TIPS_RECEIPT_CODE}}：{{xiaopiao.record.record_code}} 
            </p>	
            <table class="detail_table">
                <tr>
                    <td class="name"><!--日期-->{{language.TIPS_RECEIPT_DATE}}：</td>
                    <td class="val">{{xiaopiao.record.record_time}}</td>
                    <td class="name"><!--店铺-->{{language.TIPS_RECEIPT_SHOP}}：</td>
                    <td class="val">{{xiaopiao.record.ShopName}}</td>
                </tr>
                <tr>
                    <td class="name"><!--收银员-->{{language.TIPS_CASHIER_MEN}}：</td>
                    <td class="val">{{xiaopiao.record.trade_user_name}}</td>
                    <td class="name"><!--导购员-->{{language.TIPS_CASHIER_SHOPPING_GUIDE}}：</td>
                    <td class="val">{{xiaopiao.record.guide_user_name}}</td>
                    
                </tr>
                <tr>
                    <td class="name"><!--数量-->{{language.TIPS_RECEIPT_NUM}}：</td>
                    <td class="val">{{xiaopiao.record.num}}</td>
                    <td class="name"><!--总价-->{{language.TIPS_RECEIPT_TOTAL_PRICE}}：</td>
                    <td class="val">{{xiaopiao.record.money|number:2}}</td>
                </tr>
                <tr>
                    <td class="name"><!--状态-->{{language.TIPS_RECEIPT_STATUS}}：</td>
                    <td class="val">{{xiaopiao.record.is_checkout|check_is_checkout}}</td>
                    <td class="name"><!--实付-->{{language.TIPS_RECEIPT_ACTUALLY_PAID}}：</td>
                    <td class="val">{{xiaopiao.record.paymoney|number:2}}</td>
                    
                </tr>
                <tr>
                    <td class="name"><!--更新时间-->{{language.TIPS_RECEIPT_UPDATE_TIME}}：</td>
                    <td class="val">{{xiaopiao.record.lastchanged}}</td>
                    <td class="name"><!--设备编号-->{{language.TIPS_RECEIPT_DEVICE_ID}}：</td>
                    <td colspan="3">{{xiaopiao.record.deviceId}}</td>
                </tr>
                <tr>
                    <td class="name"><!--整单备注-->{{language.TIPS_ALL_REMARK}}:</td>
                    <td colspan="3">{{xiaopiao.record.remark}}</td>
                </tr>
                <tr>
                    <td class="name"><!--二维码-->二维码:</td>
                    <td colspan="3"><div id="present_bar_code_order"><div/></td>
                </tr>
            </table>
        </form>
        <form class="detail_form">
            <p class="title"><!--商品明细-->{{language.TIPS_RECEIPT_DETAILED}}</p>  
            <table class="goods_table">
                <tr>
                    <th>sku</th>
                    <th><!--名称-->{{language.TIPS_RECEIPT_NAME}}</th>
                    <th><!--数量-->{{language.TIPS_RECEIPT_NUM}}</th>
                    <th><!--单价-->{{language.TIPS_RECEIPT_UNIT_PRICE}}</th>
                    <th><!--总价-->{{language.TIPS_RECEIPT_TOTAL_PRICE}}</th>
                    <th><!--导购员-->{{language.TIPS_CASHIER_SHOPPING_GUIDE}}</th>
                    
                </tr>
                <tr ng-repeat="p in xiaopiao.record_detail">
                    <td>{{p.sku}}</td>
                    <td>{{p.goods_name}}[{{p.color_name}} {{p.size_name}}]</td>
                    <td>{{p.num}}</td>
                    <td>{{p.price|number:2}}</td>
                    <td>{{p.money|number:2}}</td>
                    <td>{{p.guide_user_name}}{{p.daogou_name}}</td>
                </tr>
            </table>

            <p class="title"><!--支付明细-->{{language.TIPS_RECEIPT_PAY_DETAIL}}</p>  
            <table class="goods_table">
                <tr>
                    <th><!--支付代码-->{{language.TIPS_RECEIPT_PAY_NAME}}</th>
                    <th><!--金额-->{{language.TIPS_RECEIPT_MONEY}}</th>
                    <th><!--备注-->{{language.TIPS_RECEIPT_REMARK}}1</th>
                    <th><!--备注-->{{language.TIPS_RECEIPT_REMARK}}2</th>
                </tr>
                <tr ng-repeat="p in xiaopiao.payment">
                    <td>{{p.trade_type_name}}</td>
                    <td>{{p.money|number:2}}</td>
                    <td>{{p.reason}}</td>
                    <td>{{p.remark}}</td>
                </tr>
            </table>

            <!--<p class="title">{{language.TIPS_RECEIPT_OFFER_DETAIL}}</p>-->
            <p class="title"><!--促销明细-->{{language.TIPS_ORDER_PROMOTION_TITLE}}</p>  
            <table class="goods_table">
                <tr>
                    <th><!--活动名称-->{{language.TIPS_RECEIPT_ACTIVITY_NAME}}</th>
                    <!--<th>{{language.TIPS_RECEIPT_DISCOUNT_AMOUNT}}</th>-->
                    <th><!--备注-->{{language.TIPS_RECEIPT_REMARK}}</th>
                </tr>
                <tr ng-repeat="p in xiaopiao.promotion">
                    <td>{{p.short_name}}</td>
                    <td>{{p.dis_pro_money}}</td>
                </tr>
            </table>
            <!--added by lqx maowei on 20170411 增加订单详细页优惠券显示-->
            <div ng-show="coupon_display == 1">
                <p class="title"><!--优惠券明细-->{{language.TIPS_ORDER_COUPON_TITLE}}</p>  
                <table class="goods_table">
                    <tr>
                        <th>{{language.TIPS_ORDER_COUPON_CODE}}</th>
                        <th>{{language.TIPS_ORDER_COUPON_FEE}}</th>
                    </tr>
                    <tr ng-repeat="p in xiaopiao.payment">
                        <td ng-if="p.trade_type_code == '003'">{{p.coupon_code}}</td>
                        <td ng-if="p.trade_type_code == '003'">{{p.money|number:2}}</td>
                    </tr>
                    <tr ng-repeat="f in fund_bill_list">
                        <td>{{f.fund_name}}</td>
                        <td>{{f.amount|number:2}}</td>
                    </tr>
                </table>
            </div>
        </form>
    </div>    
</div>